<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>





        var t = setInterval(function () {
            var date1 = new Date();

            var date2 = new Date(2023, 4, 19, 15, 10, 0);

            var gap = date2 - date1;

            gap = parseInt(gap / 1000);
            console.log(gap);   // 毫秒数

            if (gap < 0) {
                clearInterval(t)
            }
        }, 1000)

    </script>

</body>

</html>